package com.mes.basicdata.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.bstek.bdf2.core.model.DefaultUser;
import com.mes.common.domain.BasicModel;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name="R_EMPLOYEE")
@BatchSize(size=20)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Employee extends BasicModel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public final static String EMPLOYEESTATE_VIRTUAL = "VIRTUAL";
	
	// 人员编号
	@Id
	@GenericGenerator(name = "employeeId", strategy = "assigned")
	@Column(name="EMPLOYEEID",length=50)
	private String employeeUid;
	
	// 人员姓名
	@Column(name="EMPLOYEENAME",length=100,nullable=false)
	private String employeeName;
	
	// 检验印章
	@Column(name="EMPLOYEEID1",length=20)
	private String checkPrint;
	
	// 部门
	@Column(name="DEPTID",length=50)
	private String deptUid;
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="DEPTID",insertable=false,updatable=false)
//	@NotFound(action=NotFoundAction.IGNORE)
	private Dept dept;
	
	// 分组ID
	@Column(name="GROUPID",length=20)
	private String groupId;
	
	@Column(name="CONFIRMTYPE",precision=10)
	private Integer confirmType;
	
	// 胸卡号
	@Column(name="CARDID",length=50)
	private String cardId;
	
	@Column(name="SEX",precision=22)
	private Integer sex;
	
	@Column(name="PASSWORD",length=50)
	private String password;
	
//	@Column(name="POSITIONID",length=20)
//	private String positionId;
//	
//	@Column(name="WEB",length=50)
//	private String web;
//	
//	@Column(name="MARRIED",precision=22)
//	private Integer married;
	
	@Column(name="EMAIL",length=50)
	private String email;
	
	@Column(name="CELLPHONE",length=20)
	private String cellphone;
	
	@Column(name="EMPLOYEETYPE",length=20)
	private String employeeType;
	
	@Column(name="DEGREE",length=20)
	private String degree;
	
	@Column(name="BIRTH",length=7)
	private Date birth;
	
	//BDF用户
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="BDFUSER")
	private DefaultUser BDFUser;

	
	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getEmployeeUid();
	}
	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setEmployeeUid(uuid);
	}
	
	public String getEmployeeUid() {
		return employeeUid;
	}
	public void setEmployeeUid(String employeeUid) {
		this.employeeUid = employeeUid;
	}
	public String getGroupId() {
		return groupId;
	}
	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public String getEmployeeName() {
		return employeeName;
	}
	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getCellphone() {
		return cellphone;
	}
	public void setCellphone(String cellphone) {
		this.cellphone = cellphone;
	}
	public String getEmployeeType() {
		return employeeType;
	}
	public void setEmployeeType(String employeeType) {
		this.employeeType = employeeType;
	}
	public String getDegree() {
		return degree;
	}
	public void setDegree(String degree) {
		this.degree = degree;
	}
	public Date getBirth() {
		return birth;
	}
	public void setBirth(Date birth) {
		this.birth = birth;
	}
	public String getDeptUid() {
		return deptUid;
	}
	public void setDeptUid(String deptUid) {
		this.deptUid = deptUid;
	}
	public Dept getDept() {
		return dept;
	}
	public void setDept(Dept dept) {
		this.dept = dept;
	}
	public Integer getConfirmType() {
		return confirmType;
	}
	public void setConfirmType(Integer confirmType) {
		this.confirmType = confirmType;
	}
	public String getCardId() {
		return cardId;
	}
	public void setCardId(String cardId) {
		this.cardId = cardId;
	}

	public String getCheckPrint() {
		return checkPrint;
	}

	public void setCheckPrint(String checkPrint) {
		this.checkPrint = checkPrint;
	}
	public DefaultUser getBDFUser() {
		return BDFUser;
	}
	public void setBDFUser(DefaultUser bDFUser) {
		BDFUser = bDFUser;
	}
	

}